﻿Castle Thief by onlineprof2010
10 Line Basic program on the Commodore 64  (2018)                
255 char max per line

OVERVIEW

In days of olden, there were castles, dragons, knights, kings, and wizards.  When all the young ones were choosing a character class, you chose the thief.  All the glory went to all your friends who chose the knight or wizard class.  So you decided to ransack some castles to make yourself feel better.  Cross the bridge and avoid the castle defenses.


RUNNING THE GAME

The game requires a boost in the emulation speed due to high number of sprites and indexing.
Settings->Maximum Speed->Custom
Enter 1200
Hit OK

The game can be played at other speeds but %1200 is recommended. 

In the vice emulator, select FILE->Autostart disk/tape image
Select the file cthief.bas


GAME INSTRUCTIONS	

In joystick port 2, use the button to jump up.  Left and right will also take you in those directions.  Holding the joystick right while jumping or still in the air will make you jump the farthest.  As a thief you are quire agile and can reverse direction while in midair. Make it into the castle to steal its many riches.  As the levels go on, more and more obstacles will be added until up to 7 are on the screen.

Once you out of lives,type
    RUN    
to play again.

Obstacles:
Snakes - these stationary creatures will kill you in one strike with their venom.  After flying on planes, some have also learn to fly themselves.

Arrows - The fastest objects to avoid.  These are shot from the skilled archers of the castle

Ghosts - Fast flying ghosts of all thieves who died previously trying to cross the bridge.

Fireballs - The king has hired some wizards to protect the castle.  Fortunately all they know how to cast is the fireball spell.  Still watch out as they can be deadly!


DEVELOPER’S NOTES

The game was written in 10 lines of basic for the Commodore 64.  There are a maximum of 255 characters per line.  The built in basic editor of the commodore 64 only allows 80.  However, by using CBM prg studio, basic programs with up to 255 characters were easily possible.


Listing:

1pO53248,128:pO53249,50:?chr$(147):pO53278,0:pO53280,0:pO53281,0:dIl(3),h(3),v(3):pO2040,255:y=167:fOi=0to2:rEl(i):rEh(i):rEv(i):nE:fOz=15808to16382:pOz,0:nE:pO53279,0:pO53269,255:g=64:pO53271,255:pO53277,255:dIspx(7):dIeup(7):s=rN(0):dIco(11):pO53287,1
2ca=1:dIch(11):dIx1(11):dIy1(11):dIx2(11):dIy2(11):fOi=0to10:rEco(i):rEch(i):rEx1(i):rEy1(i):rEx2(i):rEy2(i):fOx3=x1(i)tox2(i):fOy3=y1(i)toy2(i):s1=1024+x3+y3*40:pOs1,ch(i):pOs1+54272,co(i):nE:nE:nE:live=9:pO2040,255
3addr=15808:fori=0to8:forj=0to7:rEz:pOaddr,z:addr=addr+3:nE:addr=addr+40:nE:pO1461,254:pO1462,254:pO1463,254
4fOi=0to6:pO53250+(i*2),0:pO53251+(i*2),0:eup(i)=0:spx(i)=0:nE:?chr$(19):pO53278,0:pO646,1:?"  level"ca:?"  lives"live:x=30:y=167:o=0:p=0:num=cas/4:ifnum>6tHnum=6
5fori=0tonum:spx(i)=0:eup(i)=0:pO(53250+(i*2)),int(rN(0)*5)*35+70:pO(53251+(i*2)),(22*int(rN(0)*2))+145:spx(i)=int(rN(0)*7)-3:nE:fOi=0tonum:pO2041+i,(250+spx(i)):pO53288+i,i+4+spx(i):nE:iflives=0tH?"game over":eN:
6fOi=0to6:temp=53250+(i*2):pOtemp,(((pE(temp))+spx(i))aN255):pO(temp+1),((pE(temp+1))aN255):nE:o=0:p2=0:fOi=0to2:if((pE(56320)aNl(i))=0)tHo=o+h(i):p2=p2+v(i)*(y>166):z=pE(2040):pO2040,(z=255)*2+1+z
7nE:x=x-2*(x<10):pO53248,x:pO53249,y:p=p+g:p=p*(-(y<167)):p=p-p2:if(pE(53278)aN1)=1thenlive=live-1:fori=0to1700:pO53287,9:pO53287,2:pO53287,1:nE:pO53249,255:pO53278,0:pO53248,255:gO4
8ifx<250thenx=x+o:y=y+(p/64):gO6:REM game by onlineprof2010 2018
9ca=ca+1:pO53249,255:gO4:dA4,-2,0,8,2,0,16,0,-512,9,160,0,23,39,24,6,160,0,20,29,22,8,160,0,16,29,17,15,160,30,4,36,22,8,160,14,18,17,22,12,160,37,10,39,22,15,160,28,2,29,7,15,160,32,2,34,3,15,160,37,2,38,7,0,32,33,6,33,8,0,32,32,7,34,7
10dA65,254,65,0,0,0,0,0,0,117,250,245,122,0,0,0,153,189,255,126,60,60,24,24,0,48,24,52,4,56,64,60,0,174,95,175,94,0,0,0,153,189,255,126,60,60,24,24,130,127,130,0,0,0,0,0,24,24,56,94,24,28,116,70,24,24,26,60,88,24,56,44

1 Initialization
2 Draw Castle and Bridge background
3 Pull in sprite data from data on line 10
4 New level intialization
5 Setup sprites.  Each sprite will get an X,Y,and velocity
6 Loop through all monster sprites.  Check Player Joystik
7 Update player sprite based on joystick and gravity.  Check collision with obstacles.
8 Check to see if player has reached the castle.  If so increase level and goto New level intialization
9 Data: Player joystick array response.  Background data which stores x,y,x1,x2 which will create a box.  You also specify char and color to go with the box.
10 - Sprite Data


Variable List:

s = seed
ca =  castle level
g = gravity
i,j = general loop counter
z = temp variable
x = sprite x position
y = sprite y position
l = joystick direction lookup table
h = delta horizontal movement from joystick 
v = delta vertical movement from joystick 
o = hor velocity
p = ver velocity
